function Node(value){
    this.val = value;
    this.left = null;
    this.right = null;
}

var a = new Node("a");
var b = new Node("b");
var c = new Node("c");
var d = new Node("d");
var e = new Node("e");
var f = new Node("f");
a.left = b;
a.right = c;
b.left = d;
b.right = e;
d.left = f;
function Mirror(root)
{
    // write code here
    if(root == null) return;
    if(root.left == null && root.right == null) return;
    var temp = root.left;
    root.left = root.right;
    root.right = temp;
    if(root.left){
        Mirror(root.left);
    }
    if(root.right){
        Mirror(root.right);
    }
}
Mirror(a);
console.log(a);